package cn.growthgate.fgo.entity;

import java.io.Serializable;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;

import cn.growthgate.fgo.entity.enums.MenuType;

/**
 * <p>
 * 菜单
 * </p>
 *
 * @author GrowthGate
 * @since 2019-04-27
 */
@TableName("t_sys_menu")
public class Menu extends Model<Menu> {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键id
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	/**
	 * 父菜单id
	 */
	private Long parentId;

	/**
	 * 类型
	 */
	@NotNull(message = "类型不能为空")
	private MenuType type;

	/**
	 * 名称
	 */
	@NotBlank(message = "名称不能为空")
	private String name;

	/**
	 * 英文名称
	 */
	@NotBlank(message = "英文名称不能为空")
	private String eName;

	/**
	 * 链接地址
	 */
	private String url;

	/**
	 * 排序
	 */
	private Integer sort;

	/**
	 * 可访问角色（没有则不限）
	 */
	private String roles;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public MenuType getType() {
		return type;
	}

	public void setType(MenuType type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String geteName() {
		return eName;
	}

	public void seteName(String eName) {
		this.eName = eName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getRoles() {
		return roles;
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		return "Menu{" + "id=" + id + ", parentId=" + parentId + ", type=" + type + ", name=" + name + ", eName="
				+ eName + ", url=" + url + ", sort=" + sort + ", roles=" + roles + "}";
	}

}
